<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>test</title>
<style type="text/css">@import url(../README.css);</style>
<script type="text/javascript" src="../uuQuery.js"></script>
<script type="text/javascript" src="iterator.js"></script>
</head>
<body>
<div>
<p>:nth-child</p>
<p>上から3つの背景色をシルバーに、一行間隔で文字色を赤にします。</p>
 <ul>
  <li>list1</li>
  <li>list2</li>
  <li>list3</li>
  <li>list4</li>
  <li>list5</li>
 </ul>
</div>
<script>
window.onload = function() {
  uuQuery("div ul>li:nth-child(-n+3)").forEach(function(v) {
   v.style.backgroundColor = "silver";
  });
  uuQuery("div ul>li:nth-child(even)").forEach(function(v) {
   v.style.color = "red";
  });
}
</script>
<pre class="eg">
  &lt;div&gt;
   &lt;ul&gt;
    &lt;li&gt;list1&lt;/li&gt;
    &lt;li&gt;list2&lt;/li&gt;
    &lt;li&gt;list3&lt;/li&gt;
    &lt;li&gt;list4&lt;/li&gt;
    &lt;li&gt;list5&lt;/li&gt;
   &lt;/ul&gt;
  &lt;/div&gt;

  uuQuery("div ul&gt;li:nth-child(-n+3)").forEach(function(v) {
   v.style.backgroundColor = "silver";
  });
  uuQuery("div ul>li:nth-child(even)").forEach(function(v) {
   v.style.color = "red";
  });
</pre>
</body>
</html>
